package cc.zy.base.generator.controller;

import cc.zy.base.common.annotation.ControllerEndpoint;
import cc.zy.base.common.controller.BaseController;
import cc.zy.base.common.entity.FebsResponse;
import cc.zy.base.common.entity.QueryRequest;
import cc.zy.base.common.exception.FebsException;
import cc.zy.base.common.utils.FebsUtil;
import cc.zy.base.common.utils.FileUtil;
import cc.zy.base.generator.entity.Column;
import cc.zy.base.generator.entity.GeneratorConfig;
import cc.zy.base.generator.entity.GeneratorConstant;
import cc.zy.base.generator.entity.Table;
import cc.zy.base.generator.helper.GeneratorHelper;
import cc.zy.base.generator.service.IGeneratorConfigService;
import cc.zy.base.generator.service.IGeneratorService;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.util.FileSystemUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author MrBird
 */
@Slf4j
@RestController
@RequestMapping("generatorSet")
@RequiredArgsConstructor
public class GeneratorSetController extends BaseController {

    private final IGeneratorService generatorService;

    @GetMapping("list/{schemaName},{tableName}")
    public FebsResponse tablesInfo(@PathVariable String schemaName, @PathVariable String tableName) {
        return new FebsResponse().success().data(generatorService.getColumns(GeneratorConstant.DATABASE_TYPE,schemaName,tableName));
    }

}


